<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>PF屏幕共享</title>
    <script src="../static/jquery-3.2.1.min.js">
    </script>
    <link rel="shortcut icon" href="static/favicon.ico" type="image/x-icon">
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        img {
            width: 1000px;
            border-radius: 10px;
            display: block;
            margin: 0 auto;
        }
    </style>
</head>
<body id="mybody">
<h1 style="display: none" id="myip">{{ myip }}</h1>
<iframe id="iframe" sandbox="allow-same-origin" style="display:none;"></iframe>
</body>
<script>


    $.get('/js_get', {'method': 'GET', 'text': "frame-html"}, function (data) {

        $('#mybody').append("<img src=\"{{ url_for('video') }}\" id=\"img\">")
        //视频大小初始化
        let img = document.getElementById('img');
        img.style.width = document.body.offsetWidth + 'px';
        //跟随浏览器改变大小
        window.onresize = function () {
            img.style.width = document.body.offsetWidth + 'px';
        }
    })
    //監聽窗口關閉
    window.onunload = function () {
        $.get('/post_message', {'method': 'GET', 'text': 'post-html'}, function (data) {

        })
    }


    // //视频大小初始化
    // let img = document.getElementById('img');
    // img.style.width = document.body.offsetWidth + 'px';
    // //跟随浏览器改变大小
    // window.onresize = function () {
    //     img.style.width = document.body.offsetWidth + 'px';
    // }
    function auth() {
        $.ajaxSettings.async = false;
        $.get('/special',{'method': 'GET','text': 'special-html'} ,function (data) {
            specialip = data.substring(0,12);
            specialip2 = data.substring(12);
        })
         $.ajaxSettings.async = true;
    }
    function get_userip() {
        //獲取訪問者ip
         $.ajaxSettings.async = false;
        $.get('/get_userip', {'method': 'GET', 'text': 'test-html'}, function (data) {
            userip = data
        })
         $.ajaxSettings.async = true;
    }


</script>
</html>
